// import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'

import { createPinia } from 'pinia';
import { useIntersectionObserver } from '@vueuse/core'

const app = createApp(App)

app.config.globalProperties.$axios = axios

app.use(router)

// 注册 Pinia 插件
const pinia = createPinia();
app.use(pinia);

app.mount('#app')


app.directive("img-lazy", {
    mounted(el, binding) {
        useIntersectionObserver(
            el,
            ([{ isIntersecting }]) => {
                if (isIntersecting) {
                    console.log(isIntersecting)
                    el.src = binding.value
                }
            }
        )
    }
})
